#ifndef _SIMPLE_TRAIL_H_
#define _SIMPLE_TRAIL_H_

#include "math/vec2.h"
#include <string>
#include "math/counter.h"
class Image;
class Graphics;

namespace vfx
{

class	SimpleTrail
{
public:
	struct	Node
	{	
		math::Vec2	From, To;
		float		Time;
	};	

					SimpleTrail(const std::string& Image, float	GenTime, float Timout, bool additive);
					~SimpleTrail();
	void			Render(const math::Vec2& Offset, float Scale);
	void			RenderSet(Node* pSet, int Count);
	
	void			UpdatePos(const math::Vec2& From, const math::Vec2& To);
	void			Tick(float dt);
	void			Clear();
private:
	void			CopyNodes();
	void			CreateNodes(float	GenTime, float Timout);
	void			SetImage(const std::string& Name);

	math::Counter	m_AddNode;
	float			m_GenTime, m_Timeout;

	float			m_Width;
	Image*			m_pImage;
	bool			m_Additive;

	int				m_NodeC;
	int				m_LowNode;
	int				m_HighNode;
	Node*			m_NodeA;

	void			SetupRenderState(Graphics* pG);
	void			RestoreRenderState(Graphics* pG);
};

}  // namespace vfx




#endif // _SIMPLE_TRAIL_H_